<?php
/**
 * Created by PhpStorm.
 * User: 13469
 * Date: 2018/12/8
 * Time: 10:31
 */
include "config.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    if(isset($_REQUEST["utel"])&&isset($_REQUEST["upwd"])){
        $UTEL=$_REQUEST["utel"];
        $UPWD=$_REQUEST["upwd"];
//        $EMAIL=$_REQUEST["uemail"];
        $EMAIL=isset($_REQUEST["uemail"])?$_REQUEST["uemail"]:"";
//        $UREALLYNAME=$_REQUEST["reallyname"];
        $UREALLYNAME=isset($_REQUEST["reallyname"])?$_REQUEST["reallyname"]:"";
        $sql="INSERT INTO userinfo (`u_tel`,`u_pwd`,`u_email`,`u_reallyname`)VALUES(?,?,?,?)";
        $stmt=$conn->prepare($sql);
        $stmt->bind_param("ssss", $UTEL, $UPWD,$EMAIL,$UREALLYNAME);
        $stmt->execute();

        if($stmt->affected_rows>=1){
            print_r(json_encode(array("status"=>1,"msg"=>"注册成功")));
        }else{
            print_r(json_encode(array("status"=>-1,"msg"=>"注册失败")));
        }
    }else{
        print_r(json_encode(array("status"=>-2,"msg"=>"请输入手机号或密码")));
    }
}else{
    print_r(json_encode(array("status"=>0,"msg"=>"不支持get请求")));
}

$conn->close();